import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/create_order_entity.dart';

CreateOrderEntity $CreateOrderEntityFromJson(Map<String, dynamic> json) {
  final CreateOrderEntity createOrderEntity = CreateOrderEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    createOrderEntity.msg = msg;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    createOrderEntity.code = code;
  }
  final CreateOrderData? data = jsonConvert.convert<CreateOrderData>(
      json['data']);
  if (data != null) {
    createOrderEntity.data = data;
  }
  return createOrderEntity;
}

Map<String, dynamic> $CreateOrderEntityToJson(CreateOrderEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['code'] = entity.code;
  data['data'] = entity.data?.toJson();
  return data;
}

extension CreateOrderEntityExtension on CreateOrderEntity {
  CreateOrderEntity copyWith({
    String? msg,
    int? code,
    CreateOrderData? data,
  }) {
    return CreateOrderEntity()
      ..msg = msg ?? this.msg
      ..code = code ?? this.code
      ..data = data ?? this.data;
  }
}

CreateOrderData $CreateOrderDataFromJson(Map<String, dynamic> json) {
  final CreateOrderData createOrderData = CreateOrderData();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    createOrderData.createTime = createTime;
  }
  final CreateOrderDataParams? params = jsonConvert.convert<
      CreateOrderDataParams>(json['params']);
  if (params != null) {
    createOrderData.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    createOrderData.id = id;
  }
  final String? orderNo = jsonConvert.convert<String>(json['orderNo']);
  if (orderNo != null) {
    createOrderData.orderNo = orderNo;
  }
  final int? orderType = jsonConvert.convert<int>(json['orderType']);
  if (orderType != null) {
    createOrderData.orderType = orderType;
  }
  final String? orderTitle = jsonConvert.convert<String>(json['orderTitle']);
  if (orderTitle != null) {
    createOrderData.orderTitle = orderTitle;
  }
  final double? orderAmount = jsonConvert.convert<double>(json['orderAmount']);
  if (orderAmount != null) {
    createOrderData.orderAmount = orderAmount;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    createOrderData.status = status;
  }
  final String? serialNumber = jsonConvert.convert<String>(
      json['serialNumber']);
  if (serialNumber != null) {
    createOrderData.serialNumber = serialNumber;
  }
  final int? memberLevelId = jsonConvert.convert<int>(json['memberLevelId']);
  if (memberLevelId != null) {
    createOrderData.memberLevelId = memberLevelId;
  }
  return createOrderData;
}

Map<String, dynamic> $CreateOrderDataToJson(CreateOrderData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['orderNo'] = entity.orderNo;
  data['orderType'] = entity.orderType;
  data['orderTitle'] = entity.orderTitle;
  data['orderAmount'] = entity.orderAmount;
  data['status'] = entity.status;
  data['serialNumber'] = entity.serialNumber;
  data['memberLevelId'] = entity.memberLevelId;
  return data;
}

extension CreateOrderDataExtension on CreateOrderData {
  CreateOrderData copyWith({
    String? createTime,
    CreateOrderDataParams? params,
    int? id,
    String? orderNo,
    int? orderType,
    String? orderTitle,
    double? orderAmount,
    int? status,
    String? serialNumber,
    int? memberLevelId,
  }) {
    return CreateOrderData()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..orderNo = orderNo ?? this.orderNo
      ..orderType = orderType ?? this.orderType
      ..orderTitle = orderTitle ?? this.orderTitle
      ..orderAmount = orderAmount ?? this.orderAmount
      ..status = status ?? this.status
      ..serialNumber = serialNumber ?? this.serialNumber
      ..memberLevelId = memberLevelId ?? this.memberLevelId;
  }
}

CreateOrderDataParams $CreateOrderDataParamsFromJson(
    Map<String, dynamic> json) {
  final CreateOrderDataParams createOrderDataParams = CreateOrderDataParams();
  return createOrderDataParams;
}

Map<String, dynamic> $CreateOrderDataParamsToJson(
    CreateOrderDataParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension CreateOrderDataParamsExtension on CreateOrderDataParams {
}